package basic.study.nowcoder;

import java.util.Scanner;

/**
 * @ClassName WashCards
 * @Description
 * @Company inspur
 * @Author Kevin
 * @Date 2020/6/23 16:42
 * @Version 1.0
 */
public class WashCards {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int groupNums = sc.nextInt();
        while (groupNums-- > 0) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            int[] res = new int[2*n];
            for (int i = 0; i < 2*n; i++) {
                int temp = i + 1;
                for (int j = 0; j < k; j++) {
                    if (temp <= n) temp = 2 * temp -1;
                    else temp = 2 * (temp - n);
                }
                res[temp-1] = sc.nextInt();
            }
            //输出
            for (int i = 0; i < 2*n; i++) {
                if (i != 0) {
                    System.out.print(" ");
                }
                System.out.print(res[i]);
            }
            System.out.println();
        }
    }
}
